package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 攻略目录
 */
@Getter
@Setter
@JsonIgnoreProperties({"handler","json"})
public class StrategyCatalog extends BaseDomain {
    /**
     * 攻略目录名称
     */
    private String name;
    /**
     * 大攻略
     */
    private Strategy strategy;
    /**
     * 攻略目录序列号
     */
    private Integer sequence;
    /**
     * 攻略目录状态
     */
    private Boolean state;
    /**
     * 攻略目录下的文章
     */
    private List<StrategyDetail> strategyDetailList = new ArrayList<>();


    public String getJson() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        if (strategy != null) {
            map.put("strategyId", strategy.getId());
        }
        map.put("state", state);
        map.put("sequence", sequence);
        return JSONUtil.toJSONString(map);
    }
}